﻿using QWManage.DAL;
using QWManage.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BlackList.Forms
{
    public partial class FrmYiYeUserId : Form
    {
        private UserInfo _userInfo;
        public FrmYiYeUserId(UserInfo userInfo)
        {
            _userInfo = userInfo;
            InitializeComponent();
        }

        private void FrmYiYeUserId_Load(object sender, EventArgs e)
        {
            this.AcceptButton = btnOk;
            this.CancelButton = btnCancel;
            txtName.Text = _userInfo.Name;
            txtUserID.Text = _userInfo.UserID;
            txtYiYeUserId.Text = _userInfo.YiYeUserId;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            UserDAL userDAL = new UserDAL();
            string yiyeUserID = txtYiYeUserId.Text.Trim();
            userDAL.UpdateYiYeUserId(_userInfo.UserID, yiyeUserID);
            _userInfo.YiYeUserId = yiyeUserID;
            DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }
    }
}
